<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form :inline="true" :model="formModel">
        <el-form-item class="no-warn-item" label="整车物料号:" prop="materialNo">
          <el-input
            v-model="formModel.materialNo"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="车辆规格:" prop="clgg">
          <el-input
            v-model="formModel.clgg"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="状态:" prop="status">
          <hey-select v-model="formModel.status" clcd="is_effective_cd" />
        </el-form-item>
        <el-row class="submit-area">
          <el-col :span="24">
            <el-button
              v-if="hasPermission('threeGuarantee_select')"
              type="primary"
              plain
              @click="queryList(false)"
            >查询
            </el-button>
            <el-button
              v-if="hasPermission('threeGuarantee_add')"
              type="primary"
              plain
              @click="handleAdd"
            >新增
            </el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <hey-table ref="table" :table-data="tableData" :columns="columns">
      <template slot="tools">
        <el-table-column
          label="操作"
          width="120"
          fixed="right"
          header-align="center"
          align="center"
        >
          <template slot-scope="{row}">
            <span
              v-if="hasPermission('threeGuarantee_edit')"
              class="hey_tools_btn"
              @click="handleEdit(row)"
            >编辑</span>
            <span
              v-if="hasPermission('threeGuarantee_del')"
              class="hey_tools_btn"
              @click="handleDelete(row)"
            >删除</span>
          </template>
        </el-table-column>
      </template>
    </hey-table>
    <el-dialog
      v-if="dialogVisible"
      v-dialogDrag
      :close-on-click-modal="false"
      title="三包凭证维护信息"
      :visible.sync="dialogVisible"
      width="80%"
    >
      <ThreeGuarantee-mnt :page-type="operateType" :edit-data="editData" @mntSuc="queryList" />
    </el-dialog>

  </div>
</template>

<script>

export default {
  name: 'ThreeGuaranteeList',
  components: {
    ThreeGuaranteeMnt: () => import('./threeGuarantee-mnt')
  },
  props: {},
  data() {
    return {
      dialogVisible: false,
      operateType: '',
      editData: {},
      tableData: [],
      // 查询条件
      formModel: {
        materialNo: '',
        clgg: '',
        status: ''
      },
      columns: [
        { title: '三包证书编号', key: 'threeGuaranteeNo' },
        { title: '整车物料编码', key: 'materialNo' },
        { title: '邮政编码', key: 'yzbm' },
        { title: '客服电话', key: 'kfdh' },
        { title: '车辆名称', key: 'clmc' },
        { title: '车辆规格', key: 'clgg' },
        { title: '整车质量三包有效期', key: 'zczlsbyxq' },
        { title: '整车质量包修期', key: 'zczlbxq' },
        { title: '易损耗零部件的种类', key: 'yshlbjdzl' },
        { title: '易损耗零部件包修期', key: 'yshlbjbxq' },
        { title: '车身主要零部件1', key: 'cszylbj1' },
        { title: '车身主要零部件2', key: 'cszylbj2' },
        { title: '车身主要零部件3', key: 'cszylbj3' },
        { title: '车身主要零部件4', key: 'cszylbj4' },
        { title: '转向系统主要零部件1', key: 'zxxtzylbj1' },
        { title: '转向系统主要零部件2', key: 'zxxtzylbj2' },
        { title: '转向系统主要零部件3', key: 'zxxtzylbj3' },
        { title: '转向系统主要零部件4', key: 'zxxtzylbj4' },
        { title: '制动系统主要零部件1', key: 'zdxtzylbj1' },
        { title: '制动系统主要零部件2', key: 'zdxtzylbj2' },
        { title: '制动系统主要零部件3', key: 'zdxtzylbj3' },
        { title: '制动系统主要零部件4', key: 'zdxtzylbj4' },
        { title: '悬架系统主要零部件1', key: 'xjxtzylbj1' },
        { title: '悬架系统主要零部件2', key: 'xjxtzylbj2' },
        { title: '前/后桥主要 零部件1', key: 'qhqzylbj1' },
        { title: '前/后桥主要 零部件2', key: 'qhqzylbj2' },
        { title: '前/后桥主要 零部件3', key: 'qhqzylbj3' },
        { title: '特殊零件1', key: 'tslj1' },
        { title: '包修期1', key: 'bxq1' },
        { title: '特殊零件2', key: 'tslj2' },
        { title: '包修期2', key: 'bxq2' },
        { title: '特殊零件3', key: 'tslj3' },
        { title: '包修期3', key: 'bxq3' },
        { title: '特殊零件4', key: 'tslj4' },
        { title: '包修期4', key: 'bxq4' },
        { title: '特殊零件5', key: 'tslj5' },
        { title: '包修期5', key: 'bxq5' },
        { title: '特殊零件6', key: 'tslj6' },
        { title: '包修期6', key: 'bxq6' },
        { title: '特殊零件7', key: 'tslj7' },
        { title: '包修期7', key: 'bxq7' },
        { title: '特殊零件8', key: 'tslj8' },
        { title: '包修期8', key: 'bxq8' },
        { title: '特殊零件9', key: 'tslj9' },
        { title: '包修期9', key: 'bxq9' },
        { title: '特殊零件10', key: 'tslj10' },
        { title: '包修期10', key: 'bxq10' },
        { title: '特殊零件11', key: 'tslj11' },
        { title: '包修期11', key: 'bxq11' },
        { title: '特殊零件12', key: 'tslj12' },
        { title: '包修期12', key: 'bxq12' },
        { title: '特殊零件13', key: 'tslj13' },
        { title: '包修期13', key: 'bxq13' },
        { title: '特殊零件14', key: 'tslj14' },
        { title: '包修期14', key: 'bxq14' },
        { title: '特殊零件15', key: 'tslj15' },
        { title: '包修期15', key: 'bxq15' },
        { title: '特殊零件16', key: 'tslj16' },
        { title: '包修期16', key: 'bxq16' },
        { title: '特殊零件17', key: 'tslj17' },
        { title: '包修期17', key: 'bxq17' },
        { title: '特殊零件18', key: 'tslj18' },
        { title: '包修期18', key: 'bxq18' },
        { title: '特殊零件19', key: 'tslj19' },
        { title: '包修期19', key: 'bxq19' },
        { title: '特殊零件20', key: 'tslj20' },
        { title: '包修期20', key: 'bxq20' },
        { title: '特殊零件21', key: 'tslj21' },
        { title: '包修期21', key: 'bxq21' },
        { title: '特殊零件22', key: 'tslj22' },
        { title: '包修期22', key: 'bxq22' },
        { title: '特殊零件23', key: 'tslj23' },
        { title: '包修期23', key: 'bxq23' },
        { title: '特殊零件24', key: 'tslj24' },
        { title: '包修期24', key: 'bxq24' },
        { title: '特殊零件25', key: 'tslj25' },
        { title: '包修期25', key: 'bxq25' },
        { title: '特殊零件26', key: 'tslj26' },
        { title: '包修期26', key: 'bxq26' },
        { title: '特殊零件27', key: 'tslj27' },
        { title: '包修期27', key: 'bxq27' },
        { title: '特殊零件28', key: 'tslj28' },
        { title: '包修期28', key: 'bxq28' },
        { title: '特殊零件29', key: 'tslj29' },
        { title: '包修期29', key: 'bxq29' },
        { title: '特殊零件30', key: 'tslj30' },
        { title: '包修期30', key: 'bxq30' },
        { title: '特殊零件31', key: 'tslj31' },
        { title: '包修期31', key: 'bxq31' },
        { title: '特殊零件32', key: 'tslj32' },
        { title: '包修期32', key: 'bxq32' },
        { title: '特殊零件33', key: 'tslj33' },
        { title: '包修期33', key: 'bxq33' },
        { title: '特殊零件34', key: 'tslj34' },
        { title: '包修期34', key: 'bxq34' },
        { title: '特殊零件35', key: 'tslj35' },
        { title: '包修期35', key: 'bxq35' },
        { title: '特殊零件36', key: 'tslj36' },
        { title: '包修期36', key: 'bxq36' },
        { title: '特殊零件37', key: 'tslj37' },
        { title: '包修期37', key: 'bxq37' },
        { title: '特殊零件38', key: 'tslj38' },
        { title: '包修期38', key: 'bxq38' },
        { title: '特殊零件39', key: 'tslj39' },
        { title: '包修期39', key: 'bxq39' },
        { title: '特殊零件40', key: 'tslj40' },
        { title: '包修期40', key: 'bxq40' },
        { title: '特殊零件41', key: 'tslj41' },
        { title: '包修期41', key: 'bxq41' },
        { title: '特殊零件42', key: 'tslj42' },
        { title: '包修期42', key: 'bxq42' },
        { title: '特殊零件43', key: 'tslj43' },
        { title: '包修期43', key: 'bxq43' },
        { title: '特殊零件44', key: 'tslj44' },
        { title: '包修期44', key: 'bxq44' },
        { title: '特殊零件45', key: 'tslj45' },
        { title: '包修期45', key: 'bxq45' },
        { title: '特殊零件46', key: 'tslj46' },
        { title: '包修期46', key: 'bxq46' },
        { title: '特殊零件47', key: 'tslj47' },
        { title: '包修期47', key: 'bxq47' },
        { title: '特殊零件48', key: 'tslj48' },
        { title: '包修期48', key: 'bxq48' },
        { title: '特殊零件49', key: 'tslj49' },
        { title: '包修期49', key: 'bxq49' },
        { title: '特殊零件50', key: 'tslj50' },
        { title: '包修期50', key: 'bxq50' },
        { title: '特殊零件51', key: 'tslj51' },
        { title: '包修期51', key: 'bxq51' },
        { title: '特殊零件52', key: 'tslj52' },
        { title: '包修期52', key: 'bxq52' },
        { title: '特殊零件53', key: 'tslj53' },
        { title: '包修期53', key: 'bxq53' },
        { title: '特殊零件54', key: 'tslj54' },
        { title: '包修期54', key: 'bxq54' },
        { title: '特殊零件55', key: 'tslj55' },
        { title: '包修期55', key: 'bxq55' },
        { title: '特殊零件56', key: 'tslj56' },
        { title: '包修期56', key: 'bxq56' },
        { title: '状态', key: 'status', clcd: 'is_effective_cd' },
        { title: '创建时间', key: 'createTime' },
        { title: '创建人', key: 'createUsername' },
        { title: '最后修改时间', key: 'lastUpdateTime' },
        { title: '最后修改人', key: 'lastUpdateUsername' }
      ]
    }
  },
  computed: {},
  methods: {
    queryList() {
      this.$refs.table.query('/threeGuarantee/pageThreeGuarantee', this.formModel, '', false)
    },
    handleAdd() {
      this.operateType = 'add'
      this.dialogVisible = true
    },
    handleEdit(row) {
      this.dialogVisible = true
      this.operateType = 'edit'
      this.editData = row || {}
    },
    handleDelete(row) {
      this.$sure('确认删除？', _ => {
        this.post('/threeGuarantee/delete', {
          threeGuaranteeId: row.threeGuaranteeId
        }).then(_ => {
          this.$info('删除成功', this.queryList)
        })
      })
    }
  }
}
</script>
